package com.briup.mt.api;
import com.baidu.aip.imageclassify.AipImageClassify;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;

/**
 * @author pete
 * @version 1.0
 * @date 2020/12/19 16:02
 */

public class Baidu {
    public static final String APP_ID = "23180556";
    public static final String API_KEY = "VXLrYNiMAo9e0VslejV1Fiv4";
    public static final String SECRET_KEY = "mS7z8EWgaaUqOtTybGICV29pAtMSg8RA";

    public static void main(String[] args) throws JSONException {
        // 初始化一个AipImageClassify
        AipImageClassify client = new AipImageClassify(APP_ID, API_KEY, SECRET_KEY);

        // 可选：设置网络连接参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);

        // 可选：设置代理服务器地址, http和socket二选一，或者均不设置
       // client.setHttpProxy("proxy_host", proxy_port);  // 设置http代理
       // client.setSocketProxy("proxy_host", proxy_port);  // 设置socket代理

        // 调用接口
        String path = "C:\\Users\\Administrator\\Desktop\\test.jpg";
        JSONObject res = client.advancedGeneral(path, new HashMap<String, String>());
        System.out.println(res.toString(2));

    }
}

